<template>
<!-- 打款审核新增页面弹框 -->
  <div>
    <div style="height:300px">
      <FormPanel
        ref="from"
        :list="initForm"
        :cols="3"
        :isSubmitBtn="false"
        :collapse="false"
      />
    </div>
    <div class="dialogBottmView">
      <el-button :loading="loadingFlag" @click="auditCommit(30081003)" type="primary">通 过</el-button>
      <el-button :loading="loadingFlag" @click="auditCommit(30081004)" type="primary">驳 回</el-button>
      <el-button @click="closeDialog('closeDialog')">返 回</el-button>
    </div>
  </div>
</template>
<script>

import { auditCommit } from '@/api/partsmanage/financialManagement/capitalAccount/index';
import { dictionary } from '@/utils/dictMixin';

export default {
  props: {
    row: {
      type: Object,
      required: true,
      default: () => {}
    },
  },
  data(){
    return{
      initForm:this.createdFrom(),
      loadingFlag:false,
    }
  },
  mixins:[dictionary],
  methods:{
    async auditCommit(status){//审核提交
      this.loadingFlag = true;
      let [err, data] = await this.$refs.from.GET_FORM_DATA();
      if(err){
        this.loadingFlag = false; 
        return;
      } 
      this.row.auditView = data.auditView;
      this.row.paymentStatus = status;
      let result = await auditCommit(this.row);
      if (result.resultCode === 200) {
        this.$notify.success({title: '提示信息',message:'审核成功!'});
        this.loadingFlag = false;
        this.closeDialog('refresh');

      } else {
        this.$notify.error({title: '提示信息',message:result.errMsg||'审核失败!'});
      }
    },
    closeDialog(val){//关闭弹框
      this.$emit('close')
    },
    createdFrom(){
      return [
        
        {
            type: 'TEXT_AREA',
            label: '审核意见：',
            fieldName: 'auditView',
            placeholder: '请输入',
            selfCols:3,
            maxlength:150,
            rows:6
        },
      ]
    }
  },
}
</script>
